YNQ  YNQ-1.6.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
File Operations

Modules

 File Attributes
 
 File Access Mode
 
 
 File Locality
 
 File Create Action
 
 File Open Action
 
 File Seek Constants
 

Typedefs

typedef void(* CCServerSideCopyCallback )(NQ_STATUS status, NQ_UINT32 totalBytesWritten, NQ_UINT64 totalFileSize, void *context)
 

Functions

NQ_HANDLE ccCreateFileA (const NQ_CHAR *fileName, NQ_INT access, NQ_INT shareMode, NQ_INT locality, NQ_BOOL writeThrough, NQ_UINT16 attributes, NQ_INT createAction, NQ_INT openAction)
 
NQ_HANDLE ccCreateFile (const NQ_WCHAR *fileName, NQ_INT access, NQ_INT shareMode, NQ_INT locality, NQ_BOOL writeThrough, NQ_UINT16 attributes, NQ_INT createAction, NQ_INT openAction)
 
NQ_BOOL ccDeleteFileA (const NQ_CHAR *fileName)
 
NQ_BOOL ccDeleteFile (const NQ_WCHAR *fileName)
 
NQ_BOOL ccMoveFileA (const NQ_CHAR *oldFilename, const NQ_CHAR *newFilename)
 
NQ_BOOL ccMoveFile (const NQ_WCHAR *oldFilename, const NQ_WCHAR *newFilename)
 
NQ_BOOL ccReadFile (NQ_HANDLE hndl, NQ_IOBufPos buffer, NQ_UINT count, NQ_UINT *readSize)
 
NQ_BOOL ccReadFileAsync (NQ_HANDLE hndl, NQ_IOBufPos buffer, NQ_UINT count, void *context, void(*callback)(NQ_STATUS, NQ_UINT, void *))
 
NQ_BOOL ccWriteFile (NQ_HANDLE hndl, NQ_IOBufPos buffer, NQ_UINT count, NQ_UINT *writtenSize)
 
NQ_BOOL ccWriteFileAsync (NQ_HANDLE hndl, NQ_IOBufPos buffer, NQ_UINT count, void *context, void(*callback)(NQ_STATUS, NQ_UINT, void *))
 
NQ_BOOL ccFlushFile (NQ_HANDLE handle)
 
NQ_BOOL ccCloseHandle (NQ_HANDLE handle)
 

Detailed Description

Typedef Documentation

typedef void(* CCServerSideCopyCallback)(NQ_STATUS status, NQ_UINT32 totalBytesWritten, NQ_UINT64 totalFileSize, void *context)

Prototype for a callback function for server side copy chunk response. This function is called after each response from the server arrives.

Parameters
statusThe response status
totalBytesWrittenTotal bytes that was written in the file
totalFileSizeTotal file size
contextA context pointer supplied by the application. By using context, an application can distinguish between different copy chunk operations.

Function Documentation

NQ_HANDLE ccCreateFileA ( const NQ_CHAR fileName,
NQ_INT  access,
NQ_INT  shareMode,
NQ_INT  locality,
NQ_BOOL  writeThrough,
NQ_UINT16  attributes,
NQ_INT  createAction,
NQ_INT  openAction 
)

This function is called by application to create or open a file.

Parameters
fileNamePath of the file to be created/opened.
accessDesired file access mode (see File Access Mode module).
shareModeDesired file share mode (see File Share Mode module).
localityDesired file locality (see File Locality module).
writeThroughIf TRUE then no read ahead or write behind allowed on this file or device. When the response is returned, data is expected to be on the disk or device.
attributesFile attributes for a newly created file (see File Attributes module)
createActionDesired file create action (see File Create Action module).
openActionDesired file open action (see File Open Action module).
Returns
This function returns NULL if it cannot create/open a file or a valid handle otherwise. The application can inspect the error code for the failure reason.
Note
This is an ASCII version of ccCreateFile()
NQ_HANDLE ccCreateFile ( const NQ_WCHAR fileName,
NQ_INT  access,
NQ_INT  shareMode,
NQ_INT  locality,
NQ_BOOL  writeThrough,
NQ_UINT16  attributes,
NQ_INT  createAction,
NQ_INT  openAction 
)

This function is called by application to create or open a file.

Parameters
fileNamePath of the file to be created/opened.
accessDesired file access mode (see File Access Mode module: FILE_AM_READ, FILE_AM_SPECIAL_MASK, FILE_AM_READ_WRITE, FILE_AM_WRITE).
shareModeDesired file share mode (see File Share Mode module: FILE_SM_COMPAT, FILE_SM_DENY_NONE, FILE_SM_DENY_READ, FILE_SM_DENY_WRITE, FILE_SM_EXCLUSIVE).
localityDesired file locality (see File Locality module: FILE_LCL_MIXED, FILE_LCL_RANDOM, FILE_LCL_SEQUENTIAL, FILE_LCL_UNKNOWN).
writeThroughIf TRUE then no read ahead or write behind allowed on this file or device. When the response is returned, data is expected to be on the disk or device.
attributesFile attributes for a newly created file (see File Attributes module: CIFS_ATTR_ALL, CIFS_ATTR_ARCHIVE, CIFS_ATTR_DIR, CIFS_ATTR_HIDDEN, CIFS_ATTR_READONLY, CIFS_ATTR_SYSTEM, CIFS_ATTR_VOLUME).
createActionDesired file create action, can be one of the following values: FILE_CA_CREATE, FILE_CA_FAIL.
openActionDesired file open action, can be one of the following values: FILE_OA_FAIL, FILE_OA_OPEN, FILE_OA_TRUNCATE.
Returns
This function returns NULL if it cannot create/open a file or a valid handle otherwise. The application can inspect the error code for the failure reason.
NQ_BOOL ccDeleteFileA ( const NQ_CHAR fileName)

This function is called by application to delete a file.

Parameters
fileNamePath of the directory to be created
Returns
This function returns TRUE if the specified file is deleted successfully or FALSE otherwise. The application can inspect the error code for the failure reason.
Note
This is an ASCII version of ccDeleteFile()
NQ_BOOL ccDeleteFile ( const NQ_WCHAR fileName)

This function is called by application to delete a file.

Parameters
fileNamePath of the directory to be created
Returns
This function returns TRUE if the specified file is deleted successfully or FALSE otherwise. The application can inspect the error code for the failure reason.
NQ_BOOL ccMoveFileA ( const NQ_CHAR oldFilename,
const NQ_CHAR newFilename 
)

This function is called by application to move (rename) a file/directory to a different location. note, that a file cannot be moved between different remote shares.

Parameters
oldFilenamePath of the file/directory to be moved.
newFilenamePath of the file/directory to be moved to.
Returns
This function returns TRUE if the specified file is moved successfully or FALSE otherwise. The application can inspect the error code for the failure reason.
Note
This is an ASCII version of ccMoveFile()
NQ_BOOL ccMoveFile ( const NQ_WCHAR oldFilename,
const NQ_WCHAR newFilename 
)

This function is called by application to move (rename) a file/directory to a different location. note, that a file cannot be moved between different remote shares.

Parameters
oldFilenamePath of the file/directory to be moved.
newFilenamePath of the file/directory to be moved to.
Returns
This function returns TRUE if the specified file is moved successfully or FALSE otherwise. The application can inspect the error code for the failure reason.
NQ_BOOL ccReadFile ( NQ_HANDLE  hndl,
NQ_IOBufPos  buffer,
NQ_UINT  count,
NQ_UINT readSize 
)

This function is called by application to read data from the opened file.

NQ attempts to use the biggest available payload. However, if the count parameter is big enough, calling this function results in transmitting multiple SMB requests. NQ Client attempts to send these requests concurrently. Since this call is synchronous, NQ will wait for all responses to come back from the server.

NQ Client reads file bytes from its current position. For random access, use function ccSetFilePointer().

Parameters
hndlHandle value returned by calling ccCreateFile()
bufferPointer to a buffer to read the file data to
countNumber of bytes to read from the file
readSizeThe pointer to a variable which on exit receives the number of bytes actually read. This value can be NULL.
Returns
This function returns TRUE if the data is read successfully or FALSE otherwise. The application can inspect the error code for the failure reason.
NQ_BOOL ccReadFileAsync ( NQ_HANDLE  hndl,
NQ_IOBufPos  buffer,
NQ_UINT  count,
void *  context,
void(*)(NQ_STATUS, NQ_UINT, void *)  callback 
)

This function is called by application to read data from the opened file.

NQ attempts to use the biggest available payload. However, if the count parameter is big enough, calling this function results in transmitting multiple SMB requests. NQ Client attempts to send these requests concurrently. Since this call is asynchronous, NQ will not wait for all responses to come back from the server but will rather call the callback function after receiving the last response.

NQ places the actual number of data read into the first argument of the call to the callback function.

NQ Client reads bytes starting from the current position in the file. For random read use function ccSetFilePointer().

This function is not thread-protected over the same file. It assumes that there is just one thread reading file through the given handle. Otherwise, the result is undefined. It is possible, however, to read the same file over two different handles simultaneously.

Parameters
hndlHandle value returned by calling ccCreateFile().
bufferPointer to a buffer to use for reading.
countNumber of bytes to write to the file.
contextA context pointer supplied by the application. By using context, an application can distinguish between different write operations. For casting purposes first structure field must be of type NQ_BOOL representing whether response is postponed by the server, used internally by NQ Client.
callbackPointer to a callback function supplied by application. This function accepts operation status, the actual number of bytes read and an abstract context pointer supplied by the application.
Returns
This function returns TRUE if the read operations where successfully queued or FALSE otherwise.

The application can inspect the error code for the failure reason.

Because of the asynchronous character of this operation the value does not reflect read results.

Application should use callback to analyze read results.

NQ_BOOL ccWriteFile ( NQ_HANDLE  hndl,
NQ_IOBufPos  buffer,
NQ_UINT  count,
NQ_UINT writtenSize 
)

This function is called by application to write data to an open file.

Upon successful completion NQ places the actual number of data written into the memory location pointed by parameter writtenSize. On an error, this value is left unmodified.

NQ Client writes bytes starting from the current position in the file. For random write use function ccSetFilePointer().

The ccWriteFile() function can be also called for file truncation. Use ccSetFilePointer() function first to set file pointer into the desired end-of-file position. Then call the current function with zero data size. This will truncate the file.

Parameters
hndlHandle value returned by calling ccCreateFile().
bufferPointer to a buffer with bytes to be written.
countNumber of bytes to write to the file.
writtenSizePointer to a variable which will receive the number of bytes actually written. This value can be NULL.
Returns
This function returns TRUE if the data is written successfully or FALSE otherwise. The application can inspect the error code for the failure reason.
NQ_BOOL ccWriteFileAsync ( NQ_HANDLE  hndl,
NQ_IOBufPos  buffer,
NQ_UINT  count,
void *  context,
void(*)(NQ_STATUS, NQ_UINT, void *)  callback 
)

This function is called by application to write data to an open file using asynchronous operations.

Upon successful completion NQ schedules necessary write operations. When all writes will be complete, NQ will call the callback function.

When calling the callback function, NQ places the actual number of data written into the first argument of this call.

NQ Client writes bytes starting from the current position in the file. For random write use function ccSetFilePointer().

The ccWriteFile() function can be also called for file truncation. Use ccSetFilePointer() function first to set file pointer into the desired end-of-file position. Then call the current function with zero data size. This will truncate the file.

This function is not thread-protected over the same file. It assumes that there is just one thread writing to the file through the given handle. Otherwise, the result is undefined. It is possible, however, to write the same file over two different handles simultaneously. The permission to open the same file twice for read depends on the server's policies.

Parameters
hndlHandle value returned by calling ccCreateFile().
bufferPointer to a buffer with bytes to be written.
countNumber of bytes to write to the file.
contextA context pointer supplied by the application. By using context, an application can distinguish between different write operations.
callbackPointer to a callback function supplied by application. This function accepts the actual number of bytes written and an abstract context pointer supplied by the application. For casting purposes first structure field must be of type NQ_BOOL representing whether response is postponed by the server, used internally by NQ Client.
Returns
This function returns TRUE if the write operations where successfully queued or FALSE otherwise. The application can inspect the error code for the failure reason.

Because of the asynchronous character of this operation the value does not reflect write results. Application should use callback to analyze write results.

NQ_BOOL ccFlushFile ( NQ_HANDLE  handle)

This function is called by application to force server to synchronize its local buffers with the file contents.

Parameters
handleHandle value returned by calling ccCreateFile()
Returns
This function returns TRUE if the next file was found successfully or FALSE otherwise. The application can inspect the error code for the failure reason.
NQ_BOOL ccCloseHandle ( NQ_HANDLE  handle)

This function is called by application to close the file handle

Returns
This function returns TRUE if the file handle is closed successfully or FALSE otherwise. The application can inspect the error code for the failure reason.
Parameters
handleHandle value returned by calling ccCreateFile()